﻿<Window x:Class="Key2Screen.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Key2Screen="clr-namespace:Key2Screen"
        Title="Key2Screen" 
        Left="0"
        Opacity="50"
        WindowStyle="None"
        AllowsTransparency="True"
        Background="Transparent"
        Topmost="True"
        WindowStartupLocation="Manual"
        ShowInTaskbar="False">
    <Window.Resources>
        <Key2Screen:IsNullToBooleanConverter x:Key="IsNullConverter" />
    </Window.Resources>
    <Grid>
        <Viewbox>
            <ListView Background="Transparent" 
                      ItemsSource="{Binding}" 
                      BorderBrush="Transparent" 
                      HorizontalContentAlignment="Center" 
                      Visibility="{Binding Path=ListVisibility, RelativeSource={RelativeSource AncestorType=Window}}">
                <ListView.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Style.Resources>
                            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                            <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
                        </Style.Resources>
                        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                        <Setter Property="Height" Value="{Binding Height}" />
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Viewbox>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Opacity="100" 
                                       Foreground="{DynamicResource Foreground}" 
                                       FontWeight="ExtraBold" 
                                       VerticalAlignment="Center" 
                                       HorizontalAlignment="Center" 
                                       Text="{Binding Path=Text}">
                                    <TextBlock.Style>
                                        <Style TargetType="TextBlock">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Text, Converter={StaticResource IsNullConverter}}" Value="False">
                                                    <DataTrigger.EnterActions>
                                                        <BeginStoryboard>
                                                            <Storyboard Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)">
                                                                <ColorAnimation From="{StaticResource Highlight}" 
                                                            Duration="0:0:0.05" />
                                                            </Storyboard>
                                                        </BeginStoryboard>
                                                    </DataTrigger.EnterActions>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                    <TextBlock.Effect>
                                        <DropShadowEffect ShadowDepth="0"
                                      Color="{DynamicResource Shadow}"
                                      Direction="0"
                                      BlurRadius="2"/>
                                    </TextBlock.Effect>
                                </TextBlock>
                            </StackPanel>
                        </Viewbox>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Viewbox>
    </Grid>
</Window>
